<template>
	<view class="box" @click="onclick" :style="{backgroundColor: color}">
		{{ num }}
	</view>
	
	<switch @change="onChange"></switch>
	
	<button type="primary" :loading="isLoading">普通按钮</button>
</template>

<script setup>
import { ref } from 'vue';

const num = ref(0)
const color = ref('#fc359a')

const onclick = () => {
	num.value++
	color.value = '#' + String(Math.random()).substring(3,9)
}

// 是否加载
const isLoading = ref(false)
const onChange = (e) => {
	console.log(e.detail.value) // true 或 false
	isLoading.value = e.detail.value
}
</script>

<style>
.box{
	width: 200px;
	height: 200px;
	background-color: orange;
}
</style>
